<script>
	export default {
		created() {
			let currentUser = {}
			let adminData = [{
				identity: 2,
				account: 'admin',
				password: 'admin'
			}]
			let userManagement = [{
				name: '张三',
				age: '21',
				sex: 0,
				mobilePhone: '13654987621',
				IDNumber: '432169875164321469',
				email: '1264973168@qq.com',
				identity: 0,
				account: 'user',
				password: 'user'
			}, {
				name: '李斯',
				age: '26',
				sex: 1,
				mobilePhone: '13654987621',
				IDNumber: '416597651369871666',
				email: '2649873165@qq.com',
				identity: 0,
				account: 'user1',
				password: 'user1'
			}]
			let doctorManagement = [{
				name: '张明智',
				age: '32',
				identity: 1,
				account: 'doctor',
				password: 'doctor',
				sex: 0,
				mobilePhone: '13649854624',
				IDNumber: '436985165948513216',
				email: '123156',
				great: '内科',
				introduction: '内科医生'
			}]
			// uni.clearStorageSync()
			if (uni.getStorageSync('currentUser') === '') {
				uni.setStorageSync('currentUser', currentUser);
			}

			if (uni.getStorageSync('adminData') === '') {
				uni.setStorageSync('adminData', adminData);
			}

			if (uni.getStorageSync('userManagement') === '') {
				uni.setStorageSync('userManagement', userManagement);
			}

			if (uni.getStorageSync('doctorManagement') === '') {
				uni.setStorageSync('doctorManagement', doctorManagement);
			}
		},
		data() {
			return {
				userManagement: [],
				doctorManagement: [],
				evaluateData: []
			};
		},
		computed: {
			store() {
				return this.$store.state
			},
		},
		watch: {
			store: {
				handler(newName, oldName) {
					// console.log(Array.isArray(this.$store.state.userManagement));
					if (Array.isArray(this.$store.state.userManagement)) {
						this.userManagement = this.$store.state.userManagement
						uni.setStorageSync('userInfo', this.userManagement)
					} else {
						this.$store.state.userManagement = uni.getStorageSync('userInfo')
					}
					if (Array.isArray(this.$store.state.doctorManagement)) {
						this.doctorManagement = this.$store.state.doctorManagement
						uni.setStorageSync('doctorInfo', this.doctorManagement)
					} else {
						this.$store.state.doctorManagement = uni.getStorageSync('doctorInfo')
					}
					if (Array.isArray(this.$store.state.evaluateData)) {
						this.evaluateData = this.$store.state.evaluateData
						uni.setStorageSync('evaluateInfo', this.evaluateData)
					} else {
						this.$store.state.evaluateData = uni.getStorageSync('evaluateInfo')
					}
				},
				immediate: true,
				deep: true
			}
		}
	}
</script>

<style>
	/*每个页面公共css */
	html {
		/* background-color: #f2f2f2; */
		background: url('http://image.iuhua.love/test/doctor.jpg') no-repeat right/cover;
		/* background-image: url('~@/static/aaa.jpg'); */
	}
</style>
